home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nebula 2
/
Nebula Two.iso
/
NextAnswers
/
UndoManager
/
UndoManager.h
< prev
next >
Wrap
Text File
|
1994-06-15
|
3KB
|
109 lines
#import <appkit/appkit.h>
// Written by: Jeff Martin (jmartin@bozell.com)
// You may freely copy, distribute and reuse the code in this example.
// Don't even talk to me about warranties.
@interface UndoManager : Object
{
id undoList; // The list that holds undo records
id redoList; // The list that holds redo records
int disabled; // Whether the UndoManager is accepting events
BOOL undoing; // Whether the UndoManager is currently undoing
BOOL redoing; // Whether the UndoManager is currently redoing
BOOL recordGrouping; // Whether UndoRecords are being grouped
int levelsOfUndo; // How many levels of undo/redo to record
id target; // Current target of registered undo messages
unsigned int freeArgsMask; // Stores which args to free
unsigned int copyArgsMask; // Make undo manager copy pointer args
id delegateList; // List of objects to be notified of UM changes
}
// Format of an undo/redo record
typedef struct UndoRecord {
marg_list args;
int freeArgsMask;
int argSize;
} UndoRecord;
- init;
// Grouping multiple UndoRecords into an undo event
- beginUndoRecordGrouping;
- endUndoRecordGrouping;
// Disable/Reenable UndoManager to prevent events from being added to undo list
- disableUndoRegistration;
- reenableUndoRegistration;
// Setting the current target for events that are received
- setUndoTarget:object;
// Setting the target or args of the next registered method to be freed when
// they fall off the end of the undo/redo list or are executed
- freeUndoTarget;
- freeUndoArgs;
- freeUndoArgAt:(int)pos;
// Setting the target or args of the next registered method to be freed when
// they fall off the end of the undo/redo list
- freeUndoTargetOnRecordDiscard;
- freeUndoArgsOnRecordDiscard;
- freeUndoArgOnRecordDiscardAt:(int)pos;
// Setting the target or args of the next registered method to be freed when
// they are executed
- freeUndoTargetOnRecordExecute;
- freeUndoArgsOnRecordExecute;
- freeUndoArgOnRecordExecuteAt:(int)pos;
// Make UndoManager copy arguments(like objects or strings) for convenience
- copyUndoArgs;
- copyUndoArgAt:(int)pos;
// Make UndoManager copy arguments and free them when record is discarded
- copyUndoArgsFreeOnDiscard;
- copyUndoArgFreeOnDiscardAt:(int)pos;
// Make UndoManager copy arguments and free them when record is executed
- copyUndoArgsFreeOnExecute;
- copyUndoArgFreeOnExecuteAt:(int)pos;
// Copies the pointer args in undoRecord as requested by copyArgsMask
- copyUndoArgsForRecord:(UndoRecord *)undoRecord;
// Overridden to capture undo/redo messages to be added to current record
- forward:(SEL)aSelector :(marg_list)argFrame;
// Removes a record from the undo/redo list and dispatches the messages in it.
- undo:sender;
- redo:sender;
// Query and set the maximum length of the undo/redo list
- (int)levelsOfUndo;
- setLevelsOfUndo:(int)value;
// These methods add and remove objects that are to receive undo notification.
- addUndoDelegate:object;
- removeUndoDelegate:object;
- sendNotification:(SEL)action;
// Used internally to free the space used for an undo/redo groups and records
- discardRecordGroup:recordGroup;
- executeRecordGroup:recordGroup;
- freeUndoRecord:(UndoRecord *)undoRecord withFreeMask:(int)mask;
// Remove and Free all records currently stored in the UndoManager
- emptyUndoManager;
// Free space used by UndoManager
- free;
@end
extern id undoManager;
@protocol UndoDelegate
- undoManagerWillUndo:sender;
- undoManagerDidUndo:sender;
@end